import * as mongoose from 'mongoose'
import * as express from 'express'
import {UserSchema} from './Schemas/userSchema'

class Main{

    db:mongoose.Connection;
    //UserModel:mongoose.Model<UserSchema>;
    constructor(){
        this.ConnectDB();
    }
    ConnectDB(){
        this.db=mongoose.createConnection('mongodb://127.0.0.1:27017/users');
        this.db.on('error',()=>{
            console.log('connect mongoose error!')
        });
        this.db.on('disconnected',()=>{
            console.log('disconnected db')
        })
    }
    // InsertUser(username:string,password:string,email:string){
    //     let usr = new User({
    //         username:username,
    //         password:password,
    //         email:email
    //     })
    // }
    
}
let m = new Main()